summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-01-23 19:31:27 +0100
committerGitHub <noreply@github.com>2024-01-23 19:31:27 +0100
commitba518f68994783f00d0dd1c1936b1a20465f6186 (patch)
tree7c2daff138094add6ca580d15e67bb9f9745b0fc
parentMerge pull request #12753 from liamwhite/why (diff)
parentservice: properly convert buffers to strings (diff)
downloadyuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.tar
yuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.tar.gz
yuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.tar.bz2
yuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.tar.lz
yuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.tar.xz
yuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.tar.zst
yuzu-ba518f68994783f00d0dd1c1936b1a20465f6186.zip
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.cpp3
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp8
-rw-r--r--src/core/hle/service/vi/vi.cpp5
3 files changed, 8 insertions, 8 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
index 6e4825313..ffe72f281 100644
--- a/src/core/hle/service/nvdrv/nvdrv_interface.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
@@ -4,6 +4,7 @@
#include "common/logging/log.h"
#include "common/scope_exit.h"
+#include "common/string_util.h"
#include "core/core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_process.h"
@@ -29,7 +30,7 @@ void NVDRV::Open(HLERequestContext& ctx) {
}
const auto& buffer = ctx.ReadBuffer();
- const std::string device_name(buffer.begin(), buffer.end());
+ const std::string device_name(Common::StringFromBuffer(buffer));
if (device_name == "/dev/nvhost-prof-gpu") {
rb.Push<DeviceFD>(0);
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 2e5785fed..429e96d11 100644
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -710,12 +710,12 @@ void ISystemSettingsServer::GetSettingsItemValueSize(HLERequestContext& ctx) {
// The category of the setting. This corresponds to the top-level keys of
// system_settings.ini.
const auto setting_category_buf{ctx.ReadBuffer(0)};
- const std::string setting_category{setting_category_buf.begin(), setting_category_buf.end()};
+ const std::string setting_category{Common::StringFromBuffer(setting_category_buf)};
// The name of the setting. This corresponds to the second-level keys of
// system_settings.ini.
const auto setting_name_buf{ctx.ReadBuffer(1)};
- const std::string setting_name{setting_name_buf.begin(), setting_name_buf.end()};
+ const std::string setting_name{Common::StringFromBuffer(setting_name_buf)};
auto settings{GetSettings()};
u64 response_size{0};
@@ -733,12 +733,12 @@ void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) {
// The category of the setting. This corresponds to the top-level keys of
// system_settings.ini.
const auto setting_category_buf{ctx.ReadBuffer(0)};
- const std::string setting_category{setting_category_buf.begin(), setting_category_buf.end()};
+ const std::string setting_category{Common::StringFromBuffer(setting_category_buf)};
// The name of the setting. This corresponds to the second-level keys of
// system_settings.ini.
const auto setting_name_buf{ctx.ReadBuffer(1)};
- const std::string setting_name{setting_name_buf.begin(), setting_name_buf.end()};
+ const std::string setting_name{Common::StringFromBuffer(setting_name_buf)};
std::vector<u8> value;
auto response = GetSettingsItemValue(value, setting_category, setting_name);
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index bfcc27ddc..1f3d82c57 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -15,6 +15,7 @@
#include "common/logging/log.h"
#include "common/math_util.h"
#include "common/settings.h"
+#include "common/string_util.h"
#include "common/swap.h"
#include "core/core_timing.h"
#include "core/hle/kernel/k_readable_event.h"
@@ -694,9 +695,7 @@ private:
void OpenLayer(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto name_buf = rp.PopRaw<std::array<u8, 0x40>>();
- const auto end = std::find(name_buf.begin(), name_buf.end(), '\0');
-
- const std::string display_name(name_buf.begin(), end);
+ const std::string display_name(Common::StringFromBuffer(name_buf));
const u64 layer_id = rp.Pop<u64>();
const u64 aruid = rp.Pop<u64>();